GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

App.log   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 5
rs 9.4285
1
'use strict';
2
3
var os = require('os'),
4
    EOL = os.EOL,
5
    Config = require('./config'),
6
    Position = require('./position'),
7
    Grid = require('./grid'),
8
    Mower = require('./mower');
9
10
// Expose `App`.
11
12
module.exports = App;
13
14
15
/**
16
 * Set up App with `options`
17
 * which is responsible for multiple-unit mower's remote control
18
 *
19
 * Options:
20
 *
21
 *   - `configFile` config file path
22
 *
23
 * @param {Object} options
24
 * @api public
25
 */
26
27
function App(options) {
28
    this.options = options || {};
29
    this.config = new Config(this.options.configFile);
30
    this.logEnabled = this.options.debug || false;
31
    this.grid = new Grid(this.config.topRightPos);
32
    this.mowers = this.createMowers(this.config.mowers);
33
}
34
35
/**
36
 * Start mower's movement.
37
 *
38
 * @api protected
39
 */
40
41
App.prototype.run = function() {
42
    var self = this;
43
    this.mowers.forEach(function(mower) {
44
        mower.start().then(function(mower) {
45
            self.log('Mower '+mower.id+' stopped at position: x:' +
46
                mower.position.x+' y:'+mower.position.y+' cardinal: '+mower.position.c+EOL)
47
        });
48
    });
49
};
50
51
/**
52
 * Create mowers
53
 *
54
 * @param {Array} mowersConf
55
 * @api protected
56
 */
57
58
App.prototype.createMowers = function(mowersConf) {
59
    var mowers = [];
60
    for(var i=0; i<mowersConf.length; i++) {
61
        var position = new Position(mowersConf[i].pos, mowersConf[i].cardinal);
62
        mowers.push(new Mower(i, this.grid, position, mowersConf[i].instructions));
63
    }
64
    return mowers;
65
};
66
67
/**
68
 * Stdout filtered by log option
69
 *
70
 * @param {String} message
71
 * @api protected
72
 */
73
74
App.prototype.log = function(message) {
75
    if(this.logEnabled) {
76
        process.stdout.write(message);
77
    }
78
};
79